package net.togogo;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class RequestApiServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("RequestApiServlet----->doget方法被调用");
        System.out.println("获取到的请求的资源路径---->" + request.getRequestURI());
        System.out.println("获取到的请求的统一资源定位符(绝对路径)---->" + request.getRequestURL());
        System.out.println("获取到的请求的客户端的ip地址---->" + request.getRemoteHost());
        System.out.println("获取到的请求的Addr---->" + request.getRemoteAddr());
        System.out.println("获取到的请求的User-Agent(浏览器信息)---->" + request.getHeader("User-Agent"));
        System.out.println("获取到的请求的方式---->" + request.getMethod());
    }
}
